package cn.itcast.user.service.impl;

import cn.itcast.user.mapper.UserMapper;
import cn.itcast.user.pojo.User;
import cn.itcast.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired  //自动注入
    private UserMapper userMapper;

    /**
     * 根据id查询User
     * @param id
     * @return
     */
    @Override
    public User queryUserById(Long id) {
        /*//  主线程睡眠2秒
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/

        return userMapper.selectByPrimaryKey(id);
    }
}
